<?php
namespace app\api\controller;
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods:POST,GET");

use app\common\controller\HomeBase;
use app\common\model\Slide as SlideModel;
use think\Db;

/**
 * 轮播图
 * Class Index
 * @package app\index\controller
 */
class Slide extends HomeBase
{
	public function _initialize()
	{
		$this->slide_model = new SlideModel();
		parent::_initialize();
	}

	/**
    *获得轮播图
    *@return json
    **/
    public function getslide()
    {
    	$cid = $this->request->param('cid');
    	if($cid){
    		$list = $this->slide_model->where('cid',$cid)->where('status',1)->order('sort','asc')->select();
    		if($list){
    			if($list){
		            $this->apiSuccess($list);
		        }else{
		            $this->apiError('没有查到信息');
		        }
    		}
    	}else{
    		$this->apiError('没有传轮播图栏目cid');
    	}
    }
}